package com.edu.dgut.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

//订单
@Data
@Table(name = "ordertable")
@Entity
public class ordertableEntity {

    //主键订单号
    @Id
    @Column(name = "ordertable_id")
    private String ordertableId;

    //微信用户openId
    private String open_id;

    //总价格
    private BigDecimal total_price;

    //订单生成日期
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date date;

    //订单完成日期
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date finish;

    //状态:0:交易中,1:已完成,2:已取消
    private int state;

    //商品表信息
    @OneToMany(cascade = CascadeType.ALL)
    private List<ordertable_goods> ordertable_goods;
}
